<template>
	<view class="card">
		<view class="title">
			<!-- 医生头像 -->
			<view class="title-img">
				<image :src="card.photoUrl" mode=""></image>
			</view>
			<!-- 医生姓名 -->
			<view class="title-infon">
				<view class="info-top">
					<text>{{card.name}}</text>
					<text class="level-text">{{levelList[card.level].dictLabel}}</text>
				</view>
				<view class="info-bot">
					<view class="bot-left">
						<image :src="administrative" mode=""></image>
						<text>{{card.title}}</text>
					</view>
					<view class="">
						成都西南中医医院
					</view>
				</view>
			</view>
		</view>
		<view class="good">
			<view class="">
				<image :src="bg" mode=""></image>
			</view>

			<view class="good-text">
				<rich-text :nodes="card.great"></rich-text>
			</view>

		</view>
		<view class="down">
			<view class="down-left">
				<text>问诊数</text>
				<text>{{card.virtuals || 0}}</text>
			</view>
			<view class="down-right">
				<view class="btn-box">
					<view class="btn">
						在线咨询
					</view>
					<button class="swipers-btn" open-type="contact" @click.stop>在线咨询</button>
				</view>

				<view class="btn btn-color" @click.top="register(card)">
					预约挂号
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import config from "../utils/config";
	export default {
		data() {
			return {
				administrative: config.ossHost + '2024/12/29/38adcab447684024a0b0cb0837f48a6b.png',
				synthesis: [],
				bg: config.ossHost + '2024/12/29/6f3a6b7c794c4330b263e010cf06006b.png',
			}
		},
		props: {
			levelList: {
				type: Array,
				default: () => [],
			},
			card: {
				type: Object,
				default: {}
			}
		},
		watch: {
			levelList(newVal, oldVal) {
				console.log('screen prop changed:', newVal);
			},
		},
		methods: {
			//挂号
			register(item) {
				item.dictLabel = this.levelList[item.level].dictLabel;
				let Details = item
				Details.great = "";
				Details.intro = "";
				uni.navigateTo({
					url: `/integration/register/index?item=${JSON.stringify(Details)}`
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.level-text {
		margin: 0 12rpx;
	}

	.card {
		color: #4D4D4D;
		font-weight: 400;
		font-size: 20rpx;
		padding: 24rpx;
		margin-bottom: 24rpx;
		background: #FFFFFF;
		border-radius: 8rpx 8rpx 8rpx 8rpx;

		// 医生信息
		.title {
			display: flex;
			align-items: center;

			.title-img {
				margin-right: 20rpx;
				width: 82rpx;
				height: 82rpx;

				image {
					width: 82rpx;
					height: 82rpx;
					border-radius: 50%;
				}
			}

			.title-infon {
				.info-top {
					display: flex;
					align-items: center;

					text:first-child {
						font-family: MiSans, MiSans;
						font-weight: bold;
						font-size: 28rpx;
						color: #1A1A1A;
					}

					text:last-child {}
				}

				.info-bot {
					display: flex;
					align-items: center;
					margin-top: 5rpx;

					.bot-left {
						display: flex;
						align-items: center;
						background: #887E5A;
						border-radius: 4rpx 4rpx 4rpx 4rpx;
						margin-right: 8rpx;
						padding: 1px 4rpx;
						color: #fff;

						image {
							width: 20rpx;
							height: 20rpx;
							margin-right: 8rpx;
						}

						text {}
					}
				}
			}
		}

		.good {
			margin-top: 12rpx;
			width: 416rpx;
			font-size: 24rpx;
			position: relative;

			.good-text {
				font-size: 20rpx;
				display: -webkit-box;
				/* 设置为 flexbox */
				-webkit-box-orient: vertical;
				/* 垂直方向排列 */
				overflow: hidden;
				/* 隐藏超出部分 */
				-webkit-line-clamp: 2;
				/* 限制显示两行 */
				text-overflow: ellipsis;
				line-height: 30rpx;
				text-indent: 90rpx;
			}

			image {
				position: absolute;
				width: 84rpx;
				height: 20rpx;
				margin-right: 5rpx;
				top: 3rpx;
			}

		}

		.down {
			margin-top: 12rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;

			.down-left {
				display: flex;
				align-items: center;

				text:last-child {
					margin-left: 5rpx;
					font-weight: bold;
					font-size: 24rpx;
					color: #CCA566;
				}
			}

			.down-right {

				display: flex;
				align-items: center;
				justify-content: space-between;

				.btn-box {
					position: relative;

					button {
						position: absolute;
						z-index: 1;
						width: 100rpx;
						height: 34rpx;
						top: 0;
						left: 16rpx;
						opacity: 0;

					}
				}

				.btn {
					margin-left: 16rpx;
					text-align: center;
					color: #67343D;
					font-size: 20rpx;
					padding: 0 8rpx;
					height: 34rpx;
					line-height: 34rpx;
					border-radius: 4rpx 4rpx 4rpx 4rpx;
					border: 1rpx solid #67343D;
					background: #fff;
				}

				.btn-color {
					color: #CCA566;
					border: 1rpx solid #CCA566;
				}
			}
		}
	}
</style>